package com.example.movephone;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.TextView;

import com.example.movephone.ui.HomepageActivity;

public class MainActivity extends AppCompatActivity {
    private TextView second;

    private CountDownTimer timer=new CountDownTimer(4000,1000) {
        @Override
        public void onTick(long l) {
            second.setText(l/1000+"秒后跳转");
        }

        @Override
        public void onFinish() {
            startActivity(new Intent(MainActivity.this, HomepageActivity.class));
            finish();
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        second=findViewById(R.id.text_second);
        timer.start();
    }

    public void tohome(View view) {
        startActivity(new Intent(MainActivity.this, HomepageActivity.class));
    }
}